function [M3 M5] = rnadangle
%RNADANGLE Free energy contributions for dangling ends in RNA secondary
%structures
%
% Source: mfold 3.2 
% Temperature: 37C
% Unit: Kcal/mol
% Data arrangement:
%
%           X
%   ------------------     
%    A    C    G    U         
%   ------------------     
%       5' --> 3'              
%          iX                   
%          j                   
%       3' <-- 5'             
%
%
%           X                  
%   ------------------       
%    A    C    G    U        
%   ------------------      
%       5' --> 3'           
%          i                
%          jX              
%       3' <-- 5'   
%
% M3(i, X + (j-1)*4)
% M5(i, X + (j-1)*4


nsb = 0; % nonstandard base

M3=[...
    
%           X                       X                       X                       X 
%   ------------------      ------------------      ------------------      ------------------ 
%    A    C    G    U        A    C    G    U        A    C    G    U        A    C    G    U 
%   ------------------      ------------------      ------------------      ------------------ 
%       5' --> 3'               5' --> 3'               5' --> 3'               5' --> 3' 
%          AX                      AX                      AX                      AX 
%          A                       C                       G                       U 
%       3' <-- 5'               3' <-- 5'               3' <-- 5'               3' <-- 5' 


   nsb   nsb   nsb   nsb   nsb   nsb   nsb   nsb   nsb   nsb   nsb   nsb  -0.80 -0.50 -0.80 -0.60 
% 
%           X                       X                       X                       X 
%   ------------------      ------------------      ------------------      ------------------ 
%    A    C    G    U        A    C    G    U        A    C    G    U        A    C    G    U 
%   ------------------      ------------------      ------------------      ------------------ 
%       5' --> 3'               5' --> 3'               5' --> 3'               5' --> 3' 
%          CX                      CX                      CX                      CX 
%          A                       C                       G                       U 
%       3' <-- 5'               3' <-- 5'               3' <-- 5'               3' <-- 5' 


    nsb   nsb   nsb   nsb   nsb   nsb   nsb   nsb  -1.70 -0.80 -1.70 -1.20  nsb   nsb   nsb   nsb
%  
%           X                       X                       X                       X 
%   ------------------      ------------------      ------------------      ------------------ 
%    A    C    G    U        A    C    G    U        A    C    G    U        A    C    G    U 
%   ------------------      ------------------      ------------------      ------------------ 
%       5' --> 3'               5' --> 3'               5' --> 3'               5' --> 3' 
%          GX                      GX                      GX                      GX 
%          A                       C                       G                       U 
%       3' <-- 5'               3' <-- 5'               3' <-- 5'               3' <-- 5' 


   nsb   nsb   nsb   nsb  -1.10 -0.40 -1.30 -0.60  nsb   nsb   nsb   nsb  -0.80 -0.50 -0.80 -0.60 

%  
%           X                       X                       X                       X 
%   ------------------      ------------------      ------------------      ------------------ 
%    A    C    G    U        A    C    G    U        A    C    G    U        A    C    G    U 
%   ------------------      ------------------      ------------------      ------------------ 
%       5' --> 3'               5' --> 3'               5' --> 3'               5' --> 3' 
%          UX                      UX                      UX                      UX 
%          A                       C                       G                       U 
%       3' <-- 5'               3' <-- 5'               3' <-- 5'               3' <-- 5' 


    -0.70 -0.10 -0.70 -0.10  nsb   nsb   nsb   nsb  -0.70 -0.10 -0.70 -0.10  nsb   nsb   nsb   nsb];

%-------------------------------------------------------------------------

M5 = [...
    
%           X                       X                       X                       X 
%   ------------------      ------------------      ------------------      ------------------ 
%    A    C    G    U        A    C    G    U        A    C    G    U        A    C    G    U 
%   ------------------      ------------------      ------------------      ------------------ 
%       5' --> 3'               5' --> 3'               5' --> 3'               5' --> 3' 
%          A                       A                       A                       A 
%          AX                      CX                      GX                      UX 
%       3' <-- 5'               3' <-- 5'               3' <-- 5'               3' <-- 5' 



    nsb   nsb   nsb   nsb   nsb   nsb   nsb   nsb   nsb   nsb   nsb   nsb  -0.30 -0.10 -0.20 -0.20

%  
%           X                       X                       X                       X 
%   ------------------      ------------------      ------------------      ------------------ 
%    A    C    G    U        A    C    G    U        A    C    G    U        A    C    G    U 
%   ------------------      ------------------      ------------------      ------------------ 
%       5' --> 3'               5' --> 3'               5' --> 3'               5' --> 3' 
%          C                       C                       C                       C 
%          AX                      CX                      GX                      UX 
%       3' <-- 5'               3' <-- 5'               3' <-- 5'               3' <-- 5' 


    nsb   nsb   nsb   nsb   nsb   nsb   nsb   nsb  -0.20 -0.30 -0.00 -0.00  nsb   nsb   nsb   nsb

%   
%           X                       X                       X                       X 
%   ------------------      ------------------      ------------------      ------------------ 
%    A    C    G    U        A    C    G    U        A    C    G    U        A    C    G    U 
%   ------------------      ------------------      ------------------      ------------------ 
%       5' --> 3'               5' --> 3'               5' --> 3'               5' --> 3' 
%          G                       G                       G                       G 
%          AX                      CX                      GX                      UX 
%       3' <-- 5'               3' <-- 5'               3' <-- 5'               3' <-- 5' 


    nsb   nsb  nsb   nsb  -0.50 -0.30 -0.20 -0.10  nsb   nsb   nsb   nsb  -0.30 -0.10 -0.20 -0.20

%  
%           X                       X                       X                       X 
%   ------------------      ------------------      ------------------      ------------------ 
%    A    C    G    U        A    C    G    U        A    C    G    U        A    C    G    U 
%   ------------------      ------------------      ------------------      ------------------ 
%       5' --> 3'               5' --> 3'               5' --> 3'               5' --> 3' 
%          U                       U                       U                       U 
%          AX                      CX                      GX                      UX 
%       3' <-- 5'               3' <-- 5'               3' <-- 5'               3' <-- 5' 


    -0.30 -0.30 -0.40 -0.20  nsb   nsb   nsb   nsb  -0.30 -0.30 -0.40 -0.20  nsb   nsb   nsb   nsb];
   

